﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:53
 ******************************************************************************/
//--------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2012 , gt TECH, Ltd.
//--------------------------------------------------------------------

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
  using RDIFramework.Utilities;

 /// <summary>
 /// PiRoleEntity
 /// 系统角色表
 ///
 /// 修改纪录
 ///
 ///		2012-03-02 版本：1.0 EricHu 创建主键。
 ///
 /// 版本：1.0
 ///
 /// <author>
 ///		<name>EricHu</name>
 ///		<date>2012-03-02</date>
 /// </author>
 /// </summary>
    [Serializable]
    public partial class PiRoleEntity
    {
        private int? id = null;
        /// <summary>
        /// 主键
        /// </summary>
        public int? Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private String systemId = string.Empty;
        /// <summary>
        /// 系统主键
        /// </summary>
        public String SystemId
        {
            get
            {
                return this.systemId;
            }
            set
            {
                this.systemId = value;
            }
        }

        private int? organizeId = null;
        /// <summary>
        /// 组织机构主键
        /// </summary>
        public int? OrganizeId
        {
            get
            {
                return this.organizeId;
            }
            set
            {
                this.organizeId = value;
            }
        }

        private String category = string.Empty;
        /// <summary>
        /// 角色分类
        /// </summary>
        public String Category
        {
            get
            {
                return this.category;
            }
            set
            {
                this.category = value;
            }
        }

        private String code = string.Empty;
        /// <summary>
        /// 角色编号
        /// </summary>
        public String Code
        {
            get
            {
                return this.code;
            }
            set
            {
                this.code = value;
            }
        }

        private String realname = string.Empty;
        /// <summary>
        /// 角色名称
        /// </summary>
        public String RealName
        {
            get
            {
                return this.realname;
            }
            set
            {
                this.realname = value;
            }
        }

        private int? allowEdit = 1;
        /// <summary>
        /// 允许编辑
        /// </summary>
        public int? AllowEdit
        {
            get
            {
                return this.allowEdit;
            }
            set
            {
                this.allowEdit = value;
            }
        }

        private int? allowDelete = 1;
        /// <summary>
        /// 允许删除
        /// </summary>
        public int? AllowDelete
        {
            get
            {
                return this.allowDelete;
            }
            set
            {
                this.allowDelete = value;
            }
        }

        private int? sortCode = null;
        /// <summary>
        /// 排序码
        /// </summary>
        public int? SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标记
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private int? enabled = 1;
        /// <summary>
        /// 有效标志
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 描述
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private String createUserId = string.Empty;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public String CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private String modifyUserId = string.Empty;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public String ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public PiRoleEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiRoleEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiRoleEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiRoleEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiRoleEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiRoleEntity GetFrom(DataRow dataRow)
        {
            this.Id = BusinessLogic.ConvertToInt(dataRow[PiRoleTable.FieldId]);
            this.SystemId = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldSystemId]);
            this.OrganizeId = BusinessLogic.ConvertToInt(dataRow[PiRoleTable.FieldOrganizeId]);
            this.Category = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldCategory]);
            this.Code = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldCode]);
            this.RealName = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldRealName]);
            this.AllowEdit = BusinessLogic.ConvertToInt(dataRow[PiRoleTable.FieldAllowEdit]);
            this.AllowDelete = BusinessLogic.ConvertToInt(dataRow[PiRoleTable.FieldAllowDelete]);
            this.SortCode = BusinessLogic.ConvertToInt(dataRow[PiRoleTable.FieldSortCode]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[PiRoleTable.FieldDeleteMark]);
            this.Enabled = BusinessLogic.ConvertToInt(dataRow[PiRoleTable.FieldEnabled]);
            this.Description = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[PiRoleTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[PiRoleTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[PiRoleTable.FieldModifiedBy]);
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiRoleEntity GetFrom(IDataReader dataReader)
        {
            this.Id = BusinessLogic.ConvertToInt(dataReader[PiRoleTable.FieldId]);
            this.SystemId = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldSystemId]);
            this.OrganizeId = BusinessLogic.ConvertToInt(dataReader[PiRoleTable.FieldOrganizeId]);
            this.Category = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldCategory]);
            this.Code = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldCode]);
            this.RealName = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldRealName]);
            this.AllowEdit = BusinessLogic.ConvertToInt(dataReader[PiRoleTable.FieldAllowEdit]);
            this.AllowDelete = BusinessLogic.ConvertToInt(dataReader[PiRoleTable.FieldAllowDelete]);
            this.SortCode = BusinessLogic.ConvertToInt(dataReader[PiRoleTable.FieldSortCode]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[PiRoleTable.FieldDeleteMark]);
            this.Enabled = BusinessLogic.ConvertToInt(dataReader[PiRoleTable.FieldEnabled]);
            this.Description = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[PiRoleTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[PiRoleTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[PiRoleTable.FieldModifiedBy]);
            return this;
        }
    }
}
